﻿@section head{
    <link rel="stylesheet" href="~/css/table.css" type="text/css">
    <script type="text/javascript"
            src="~/javascript/comm/comm.js">
    </script>
}
<!DOCTYPE html>
@*<script type="text/javascript">
    //控件判断不能为空
    function check() {
        if (document.getElementById("secondKind.secondSalaryId").value == "") {
            alert("薪酬发放责任人编号不能为空!!!");
            return false;
        }
        if (document.getElementById("secondKind.secondSaleId").value == "") {
            alert("销售责任人编号不能为空!!!");
            return false;
        }
        document.forms[0].submit();
    }
</script>*@
<body>
    <div id="app">
        <form name="configfilefirstkindForm" id="form1" role="form">
            <table width="100%">
                <tr>
                    <td>
                        <font color="black">
                            您正在做的业务是：人力资源--客户化设置--人力资源档案管理设置--II级机构设置--II级机构变更
                        </font>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <input type="button" value="提交" v-on:click="Update()" class="BUTTON_STYLE1">
                        <input type="button" value="返回" class="BUTTON_STYLE1"
                               onclick="history.back();">
                    </td>
                </tr>
            </table>

            <table width="100%" border="1" cellpadding=0 cellspacing=1
                   bordercolorlight=#848284 bordercolordark=#eeeeee
                   class="TABLE_STYLE1">
                <tr hidden>
                    <td width="19%" class="TD_STYLE1">
                        编号
                    </td>
                    <td width="81%" class="TD_STYLE2">
                        <input type="text" id="fsk_id" name="fsk_id" v-model="fsk_id" value="761" hidden />
                    </td>
                </tr>
                <tr>
                    <td width="19%" class="TD_STYLE1">
                        I级机构名称
                    </td>
                    <td width="81%" class="TD_STYLE2">
                        <input type="text" id="first_kind_name" name="first_kind_name" v-model="first_kind_name" readonly="readonly" class="INPUT_STYLE1" value="集团">
                    </td>
                </tr>
                <tr>
                    <td width="19%" class="TD_STYLE1">
                        II级机构编号
                    </td>
                    <td width="81%" class="TD_STYLE2">
                        <input type="text" id="second_kind_id" name="second_kind_id" v-model="second_kind_id" readonly="readonly" class="INPUT_STYLE1" value="1353814997520">
                    </td>
                </tr>
                <tr>
                    <td class="TD_STYLE1">
                        II级机构名称
                    </td>
                    <td class="TD_STYLE2">
                        <input type="text" id="second_kind_name" name="second_kind_name" v-model="second_kind_name" readonly="readonly" class="INPUT_STYLE1" value="二集团">
                    </td>
                </tr>
                <tr>
                    <td class="TD_STYLE1">
                        薪酬发放责任人编号（多个编号之间请用"半角逗号"加"一个空格"隔开，如", "）
                    </td>
                    <td class="TD_STYLE2">
                        <textarea rows="4" id="second_salary_id" cols="120" name="second_salary_id" v-model="second_salary_id" class="TEXTAREA_STYLE1">1</textarea>
                    </td>
                </tr>
                <tr>
                    <td class="TD_STYLE1">
                        销售责任人编号（多个编号之间请用"半角逗号"加"一个空格"隔开，如", "）
                    </td>
                    <td class="TD_STYLE2">
                        <textarea rows="4" id="second_sale_id" cols="120" name="second_sale_id" v-model="second_sale_id" class="TEXTAREA_STYLE1">2</textarea>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</body>

<script type="text/javascript">
    var vm = new Vue({
        el: "#app",
        data: {
            fsk_id: "",
            first_kind_name: "",
            second_kind_id: "",
            second_kind_name: "",
            second_salary_id: "",
            second_sale_id:""
        },
        methods: {
             load: function () {
                var t = this;
                alert(@ViewData["id"]);
                $.ajax({
                    url: "/client/second_kind_change1",
                    type: "Post",
                    data:"id="+@ViewData["id"],
                    success: function (msg) {
                        var dt = eval("("+msg+")");
                        t.fsk_id = dt.fsk_id;
                        t.second_kind_id = dt.second_kind_id;
                        t.second_kind_name = dt.second_kind_name;
                        t.first_kind_name = dt.first_kind_name;
                        t.second_salary_id = dt.second_salary_id;
                        t.second_sale_id = dt.second_sale_id;
                    }
                });
            },
            Update: function () {
                var second_salary_id = $("#second_salary_id").val();
                var second_sale_id = $("#second_sale_id").val();
                if (second_salary_id == "") {
                    alert('请输入薪酬发放责任人编号！');
                    return false;
                } else if (second_sale_id == "") {
                    alert('请输入销售责任人编号！');
                    return false;
                }
                $.ajax({
                    url: "/client/second_kind_change",
                    type: "put",
                    data: $("#form1").serialize(),
                    success: function (msg) {
                        if (msg > 0) {
                            alert("修改成功！")
                            location.href = "/client/second_kind";
                        }
                    }
                });
            }
        },
        mounted: function () {
            this.load();
        }
    });
</script>

